package p100;

public class Leetcode_122 {
    public int maxProfit(int[] prices) {
        int r = 0;
        for (int j = 1; j < prices.length; j++) {
            if (prices[j] > prices[j - 1]) {
                r += prices[j] - prices[j - 1];
            }
        }
        return r;
    }

    public static void main(String[] args) {

    }
}
